package com.zuipin.service;

import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

import com.zuipin.entity.MemberLevel;
import com.zuipin.entity.shoppingCart.RuleSet;
import com.zuipin.framework.exception.CustomException;
import com.zuipin.framework.result.PageResult;
import com.zuipin.framework.result.Result;
import com.zuipin.vo.AddCartRuleVo;
import com.zuipin.vo.AddDrawRuleVo;
import com.zuipin.vo.AddRedPacketRuleVo;
import com.zuipin.vo.AddSpecialRuleVo;
import com.zuipin.vo.AddUserBehaviorRuleVo;
import com.zuipin.vo.CheckRuleSetParam;
import com.zuipin.vo.CheckRuleSetResult;
import com.zuipin.vo.RuleListResponseVo;
import com.zuipin.vo.RuleResponseVo;
import com.zuipin.vo.SpecialPriceVo;

public interface IRuleSetService {
	Result<Map<String, Object>> addOrModityRedPacketRule(AddRedPacketRuleVo addRedPacketRuleVo)
			throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, CustomException;
	
	PageResult<List<RuleListResponseVo>> findRedRuleList(RuleSet rs, Integer pageNumber, Integer pageSize, String orderBy, String sort)
			throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
	
	RuleSet findRuleById(Long id);
	
	Result modityStatusRedRuleById(Long id, Long updateId, String status) throws CustomException;
	
	Result<Map<String, Object>> addOrModitySpecialRule(AddSpecialRuleVo addSpecialRuleVo)
			throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, CustomException;
	
	AddSpecialRuleVo findSpecialRuleDetailById(Long id, Long sysId) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
	
	PageResult<List<RuleListResponseVo>> findRuleList(RuleSet rs, Integer pageNumber, Integer pageSize, String string, String string2)
			throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
	
	Result modityStatusRuleById(Long id, Long updateId, String status, Long sysId) throws CustomException;
	
	Result<Map<String, Object>> addOrModityCartRule(AddCartRuleVo addCartRule) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, CustomException;
	
	Result<Map<String, Object>> addOrModityDrawRule(AddDrawRuleVo addDrawRuleVo) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, CustomException;
	
	AddDrawRuleVo findDrawRuleById(Long id, Long sysId) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
	
	Result<Map<String, Object>> addOrModityUserBehaviorRule(AddUserBehaviorRuleVo addUserBehaviorRuleVo)
			throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, CustomException;
	
	RuleSet findUserBehaviorRuleById(Long id);
	
	/**
	 * 查询规则是否可用
	 *
	 * @Title: checkRuleSet 
	 * @author: wuyicheng
	 * @date: 2017年7月11日下午5:25:15 
	 * @param checkRuleSetParam
	 * @return
	 * @throws ParseException
	 * @throws CustomException
	 * @return: CheckRuleSetResult
	 * @throws
	 */
	CheckRuleSetResult checkRuleSet(CheckRuleSetParam checkRuleSetParam) throws CustomException;
	
	PageResult<List<RuleListResponseVo>> findList(RuleSet rs, Integer pageNumber, Integer pageSize, String string, String string2);
	
	public List<SpecialPriceVo> findSpecialPriceBySkus(List<String> skus, Long sysId, String level, String device);
	
	List<RuleSet> findRuleSetListByIds(List<Long> ruleIds);
	
	/** 
	 * 是否超过有效期
	 * 
	 * @Title: isOverdue 
	 * @author: wuyicheng
	 * @date: 2017年7月18日上午9:12:21 
	 * @param startTime
	 * @param endTime
	 * @param currentTime
	 * @return
	 * @throws ParseException
	 * @return: boolean
	 * @throws 
	 */
	boolean isOverdue(String startTime, String endTime, String currentTime);
	
	/** 
	 * 是否符合限制会员等级
	 * 
	 * @Title: checkLimitMemberLevel 
	 * @author: wuyicheng
	 * @date: 2017年7月18日上午9:15:04 
	 * @param memberLevel
	 * @param ruleSet
	 * @return
	 * @return: boolean
	 * @throws 
	 */
	
	List<RuleSet> findRuleSetListByIds(List<Long> ruleIds, RuleSet rs);
	
	public List<RuleSet> findRule(RuleSet rs, String orderBy, String sort);
	
	public boolean checkLimitMemberLevel(MemberLevel memberLevel, RuleSet ruleSet);
	
	public void sendByUserBehavior(Long sysId, Long sysUserId, Long memberId, String device, String activityType) throws CustomException, ParseException;
	
	public RuleSet selectBySerialNumber(String serialNumber);
	
	public void updateById(RuleSet rs);
	
	PageResult<List<RuleResponseVo>> findRuleListByIds(String ids, String ruleType, Integer pageNumber, Integer pageSize, Long sysId, String status);
	
	public void modityUseNumByRuleSet(Long ruleSetId, int useNum);
}
